﻿<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>我的桌面</title>
    <!--框架必需start-->
    @*<link href="~/Content/styles/learun-ui.css" rel="stylesheet" />*@
    <script src="~/Content/Scripts/jquery/jquery-1.10.2.min.js"></script>
    <link href="~/Content/styles/font-awesome.min.css" rel="stylesheet" />
    @*<script src="~/Content/Scripts/utils/LeSoft-ui.js"></script>*@
    @System.Web.Optimization.Styles.Render("~/Content/styles/LeSoft-ui.css")
    @System.Web.Optimization.Scripts.Render("~/Content/scripts/utils/js")
    <!--框架必需end-->
    <!--第三方统计图start-->
    <script src="~/Content/Scripts/plugins/highcharts/highcharts.js"></script>
    <script src="~/Content/Scripts/plugins/highcharts/highcharts-more.js"></script>
    <script src="~/Content/Scripts/plugins/highcharts/modules/exporting.js"></script>
    <!--第三方统计图end-->
    <!--jqgrid表格组件start-->
    <link href="~/Content/scripts/plugins/jqgrid/jqgrid.css" rel="stylesheet" />
    <script src="~/Content/scripts/plugins/jqgrid/grid.locale-cn.js"></script>
    <script src="~/Content/scripts/plugins/jqgrid/jqgrid.min.js"></script>
    <!--表格组件end-->
    <script>
        $(function () {
            InitialPage();
            //LoadInterfaceVisit();
            //LoadDepartmentApp();
            GetGrid();
            GetGrid1();
            GetGrid2();
            GetGrid3();
            Stat();
        })
        //初始化
        function InitialPage() {
            $('#desktop').height($(window).height() - 22);
            $(window).resize(function (e) {
                window.setTimeout(function () {
                    $('#desktop').height($(window).height() - 22);
                    $('#gridTable').setGridWidth(($('.parent-grid').width()));
                    $("#gridTable").setGridHeight($('.parent-grid').height() - 28);
                    $('#gridTable1').setGridWidth(($('.parent-grid').width()));
                    $("#gridTable1").setGridHeight($('.parent-grid').height() - 28);
                }, 200);
                e.stopPropagation();
            });
        }
      
        //跳转到指定模块菜单
        function OpenNav(Navid) {
            top.$("#nav").find('a#' + Navid).trigger("click");
        }

        //加载表格
        function GetGrid() {
            var selectedRowIndex = 0;
            var $gridTable = $('#gridTable');
            $gridTable.jqGrid({
                url: "../../SystemManage/Task/GetPageListUserJson?State=0&Category=0",
                datatype: "json",
                height: $('.parent-grid').height() - 28,
                width: $('.parent-grid').width(),
                colModel: [
                    { label: "主键", name: "Id", hidden: true },
                    {
                        label: "", name: "Name", width: 705,
                        formatter: function (cellvalue, options, rowObject) {
                            return "[工作]  " + cellvalue;
                        }
                    },
                    {
                        label: "", name: "SendDate", width: 70, align: "right",
                        formatter: function (cellvalue, options, rowObject) {
                            return formatDate(cellvalue, 'yyyy-MM-dd');
                        }
                    }
                ],
                viewrecords: true,
                rowNum: 5,
                pager: "#gridPager",
                sortname: 'CreateDate',
                sortorder: 'desc',
                rownumbers: false,
                shrinkToFit: true,
                gridview: true,
                onSelectRow: function (rowid, status) {
                    selectedRowIndex = $("#" + this.id).getGridParam('selrow');
                    $gridTable.find("#" + selectedRowIndex).removeClass("ui-state-highlight");
                    var rowData = $gridTable.jqGrid('getRowData', rowid);
                    OpenNav(rowData.Id, 1);
                },
                gridComplete: function () {
                    $("#" + this.id).setSelection(selectedRowIndex, false);
                    $(this).closest('.ui-jqgrid-view').find('div.ui-jqgrid-hdiv').remove();
                    $("#gbox_gridTable").css("border", "0px");
                    $gridTable.css("width", $('.parent-grid').width() + "px");
                    $("#gbox_gridTable").find('td:last-child').css("border-right", "0px");
                    $gridTable.find("tr:first-child").nextAll().find("td").css("height", (($('.parent-grid').height() - 31) / 5) + "px");
                    $gridTable.find("tr").css("cursor", "pointer");
                    $gridTable.find("#" + selectedRowIndex).removeClass("ui-state-highlight");
                    var text = $("#gridPager_right").find("div").text();
                    $("#gridPager_right").find("div").text(text.substring(0, text.lastIndexOf("，")));
                }
            });
        }

        //加载表格
        function GetGrid1() {
            var selectedRowIndex = 0;
            var $gridTable = $('#gridTable1');
            $gridTable.jqGrid({
                url: "../../PublicInfoManage/Notices/GetPageListJson",
                datatype: "json",
                height: $('.parent-grid').height() - 28,
                width: $('.parent-grid').width(),
                colModel: [
                    { label: "主键", name: "NewsId", hidden: true },
                    {
                        label: "", name: "FullHead", width: 705,
                        formatter: function (cellvalue, options, rowObject) {
                            return "[" + rowObject.Category + "]  <span style='color:" + rowObject.FullHeadColor + "'>" + cellvalue + "</span>";
                        }
                    },
                    {
                        label: "", name: "ReleaseTime", width: 70, align: "right",
                        formatter: function (cellvalue, options, rowObject) {
                            return formatDate(cellvalue, 'yyyy-MM-dd');
                        }
                    }
                ],
                viewrecords: true,
                rowNum: 5,
                pager: "#gridPager1",
                sortname: 'CreateDate',
                sortorder: 'desc',
                rownumbers: false,
                shrinkToFit: true,
                gridview: true,
                onSelectRow: function (rowid, status) {
                    selectedRowIndex = $("#" + this.id).getGridParam('selrow');
                    $gridTable.find("#" + selectedRowIndex).removeClass("ui-state-highlight");
                    var rowData = $gridTable.jqGrid('getRowData', rowid);
                    OpenNav(rowData.NewsId, 2);
                },
                gridComplete: function () {
                    $("#" + this.id).setSelection(selectedRowIndex, false);
                    $gridTable.find("#" + selectedRowIndex).removeClass("ui-state-highlight");
                    $(this).closest('.ui-jqgrid-view').find('div.ui-jqgrid-hdiv').remove();
                    $("#gbox_gridTable1").css("border", "0px");
                    $gridTable.css("width", $('.parent-grid').width() + "px");
                    $gridTable.find("tr:first-child").nextAll().find("td").css("height", (($('.parent-grid').height() - 31) / 5) + "px");
                    $("#gbox_gridTable1").find('td:last-child').css("border-right", "0px");
                    $gridTable.find("tr").css("cursor", "pointer");
                    var text = $("#gridPager1_right").find("div").text();
                    $("#gridPager1_right").find("div").text(text.substring(0, text.lastIndexOf("，")));
                }
            });
        }

        //加载表格
        function GetGrid2() {
            var selectedRowIndex = 0;
            var $gridTable = $('#gridTable2');
            $gridTable.jqGrid({
                url: "../../SystemManage/Task/GetPageListUserJson?State=-1&Category=1",
                datatype: "json",
                height: $('.parent-grid').height() - 28,
                width: $('.parent-grid').width(),
                colModel: [
                    { label: "主键", name: "Id", hidden: true },
                    {
                        label: "", name: "Name", width: 705,
                        formatter: function (cellvalue, options, rowObject) {
                            return "[工作]  " + cellvalue;
                        }
                    },
                    {
                        label: "", name: "SendDate", width: 70, align: "right",
                        formatter: function (cellvalue, options, rowObject) {
                            return formatDate(cellvalue, 'yyyy-MM-dd');
                        }
                    }
                ],
                viewrecords: true,
                rowNum: 5,
                pager: "#gridPager2",
                sortname: 'CreateDate',
                sortorder: 'desc',
                rownumbers: false,
                shrinkToFit: true,
                gridview: true,
                onSelectRow: function (rowid, status) {
                    selectedRowIndex = $("#" + this.id).getGridParam('selrow');
                    $gridTable.find("#" + selectedRowIndex).removeClass("ui-state-highlight");
                    var rowData = $gridTable.jqGrid('getRowData', rowid);
                    OpenNav(rowData.Id, 1);
                },
                gridComplete: function () {
                    $("#" + this.id).setSelection(selectedRowIndex, false);
                    $(this).closest('.ui-jqgrid-view').find('div.ui-jqgrid-hdiv').remove();
                    $("#gbox_gridTable2").css("border", "0px");
                    $gridTable.css("width", $('.parent-grid').width() + "px");
                    $("#gbox_gridTable2").find('td:last-child').css("border-right", "0px");
                    $gridTable.find("tr:first-child").nextAll().find("td").css("height", (($('.parent-grid').height() - 31) / 5) + "px");
                    $gridTable.find("tr").css("cursor", "pointer");
                    $gridTable.find("#" + selectedRowIndex).removeClass("ui-state-highlight");
                    var text = $("#gridPager2_right").find("div").text();
                    $("#gridPager2_right").find("div").text(text.substring(0, text.lastIndexOf("，")));
                }
            });
        }


        //加载表格
        function GetGrid3() {
            var selectedRowIndex = 0;
            var $gridTable = $('#gridTable3');
            $gridTable.jqGrid({
                url: "../../SystemManage/Messages/GetPageListJson",
                datatype: "json",
                height: $('.parent-grid').height() - 28,
                width: $('.parent-grid').width(),
                colModel: [
                    { label: "主键", name: "Id", hidden: true },
                    {
                        label: "", name: "Head", width: 705,
                        formatter: function (cellvalue, options, rowObject) {
                            if (!cellvalue) {
                                if (cellvalue.lenght > 15)
                                    cellvalue = cellvalue.substring(0, 15) + "...";
                                return "[工作]  " + cellvalue;
                            } else {
                                if (rowObject.Abstract.lenght > 15)
                                    rowObject.Abstract = rowObject.Abstract.substring(0, 15) + "...";
                                return "[工作]  " + rowObject.Abstract;
                            }
                        }
                    },
                    {
                        label: "", name: "ModifyDate", width: 70, align: "right",
                        formatter: function (cellvalue, options, rowObject) {
                            return formatDate(cellvalue, 'yyyy-MM-dd');
                        }
                    }
                ],
                viewrecords: true,
                rowNum: 5,
                pager: "#gridPager3",
                sortname: 'ModifyDate',
                sortorder: 'desc',
                rownumbers: false,
                shrinkToFit: true,
                gridview: true,
                onSelectRow: function (rowid, status) {
                    selectedRowIndex = $("#" + this.id).getGridParam('selrow');
                    $gridTable.find("#" + selectedRowIndex).removeClass("ui-state-highlight");
                    var rowData = $gridTable.jqGrid('getRowData', rowid);
                    OpenNav(rowData.Id, 1);
                },
                gridComplete: function () {
                    $("#" + this.id).setSelection(selectedRowIndex, false);
                    $(this).closest('.ui-jqgrid-view').find('div.ui-jqgrid-hdiv').remove();
                    $("#gbox_gridTable3").css("border", "0px");
                    $gridTable.css("width", $('.parent-grid').width() + "px");
                    $("#gbox_gridTable3").find('td:last-child').css("border-right", "0px");
                    $gridTable.find("tr:first-child").nextAll().find("td").css("height", (($('.parent-grid').height() - 31) / 5) + "px");
                    $gridTable.find("tr").css("cursor", "pointer");
                    $gridTable.find("#" + selectedRowIndex).removeClass("ui-state-highlight");
                    var text = $("#gridPager3_right").find("div").text();
                    $("#gridPager3_right").find("div").text(text.substring(0, text.lastIndexOf("，")));
                }
            });
        }

        function Stat() {
            $.ajax({
                type: "GET",
                url: "/Home/GetStat",
                success: function (data) {
                    $("#Stat").html(data);
                }
            })
        }


        function OpenNav(keyValue, Type) {
            dialogOpen({
                id: "Form",
                title: '详情',
                url: '/Utility/Details?keyValue=' + keyValue + "&Type=" + Type,
                width: "1000px",
                height: "600px",
                btn: ['关闭'],
                callBack: function (iframeId) {
                    top.frames[iframeId].AcceptClick();
                }
            });
        }
    </script>
</head>
<body>
    <div class="border" id="desktop" style="margin: 10px 10px 0 10px; background: #fff; overflow: auto;">
        <div class="portal-panel">
            <div class="row">
                <div class="portal-panel-title">
                    <i class="fa fa-balance-scale"></i>&nbsp;&nbsp;统计指标
                </div>
                <div class="portal-panel-content" style="margin-top: 15px; overflow: hidden;">
                    <div class="row" id="Stat">
                       
                    </div>
                </div>
            </div>
            <div class="row" style="overflow: hidden; margin-bottom: 10px;">
                <div style="width: 50%; float: left;">
                    <div class="portal-panel-title">
                        <i class="fa fa-coffee"></i>&nbsp;&nbsp;待办任务（Top 5）
                    </div>
                    <div class="portal-panel-content parent-grid" style="overflow: hidden; padding-top: 20px;padding-left:10px;padding-right:10px;  height: 225px;">
                   
                        <table id="gridTable"></table>
                        <div id="gridPager"></div>
                    </div>
                </div>
                <div style="width: 50%; float: left;">
                    <div class="portal-panel-title">
                        <i class="fa fa-bullhorn"></i>&nbsp;&nbsp;公告/通知（Top 5）
                    </div>
                    <div class="portal-panel-content parent-grid" style="overflow: hidden; padding-top: 20px; padding-left: 10px; padding-right: 10px; height: 225px;">                       
                        <table id="gridTable1"></table>
                        <div id="gridPager1"></div>
                    </div>
                </div>
            </div>
            <div class="row" style="overflow: hidden;  margin-bottom: 10px;">
                <div style="width: 50%; float: left;">
                    <div class="portal-panel-title">
                        <i class="fa fa-coffee"></i>&nbsp;&nbsp;督办任务（Top 5）                   
                    </div>
                    <div class="portal-panel-content parent-grid" style="overflow: hidden; padding-top: 20px; padding-left: 10px; padding-right: 10px; height: 225px;">                   
                        <table id="gridTable2"></table>
                        <div id="gridPager2"></div>
                    </div>
                </div>
                <div style="width: 50%; float: left;">
                    <div class="portal-panel-title">
                        <i class="fa fa-bar-chart"></i>&nbsp;&nbsp;系统消息（Top 5）
                    </div>
                    <div class="portal-panel-content parent-grid" style="overflow: hidden; padding-top: 20px; padding-left: 10px; padding-right: 10px; height: 225px;">                    
                        <table id="gridTable3"></table>
                        <div id="gridPager3"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
  

</body>
</html>
